package com.sitia.jd.service.impl;

import java.util.List;
import com.sitia.common.utils.DateUtils;
import com.sitia.common.utils.SecurityUtils;
import com.sitia.common.utils.uuid.IdUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.sitia.jd.mapper.MxRebateActivityMapper;
import com.sitia.jd.domain.MxRebateActivity;
import com.sitia.jd.service.IMxRebateActivityService;

/**
 * 返利活动Service业务层处理
 * 
 * @author sitia
 * @date 2024-03-20
 */
@Service
public class MxRebateActivityServiceImpl implements IMxRebateActivityService 
{
    @Autowired
    private MxRebateActivityMapper mxRebateActivityMapper;

    /**
     * 查询返利活动
     * 
     * @param id 返利活动主键
     * @return 返利活动
     */
    @Override
    public MxRebateActivity selectMxRebateActivityById(String id)
    {
        return mxRebateActivityMapper.selectMxRebateActivityById(id);
    }

    /**
     * 查询返利活动列表
     * 
     * @param mxRebateActivity 返利活动
     * @return 返利活动
     */
    @Override
    public List<MxRebateActivity> selectMxRebateActivityList(MxRebateActivity mxRebateActivity)
    {
        return mxRebateActivityMapper.selectMxRebateActivityList(mxRebateActivity);
    }

    /**
     * 新增返利活动
     * 
     * @param mxRebateActivity 返利活动
     * @return 结果
     */
    @Override
    public int insertMxRebateActivity(MxRebateActivity mxRebateActivity)
    {
        mxRebateActivity.setId(IdUtils.simpleUUID())
                .setCreateTime(DateUtils.getNowDate())
                .setCreateBy(SecurityUtils.getUserId().toString());
        return mxRebateActivityMapper.insertMxRebateActivity(mxRebateActivity);
    }

    /**
     * 修改返利活动
     * 
     * @param mxRebateActivity 返利活动
     * @return 结果
     */
    @Override
    public int updateMxRebateActivity(MxRebateActivity mxRebateActivity)
    {
        mxRebateActivity.setUpdateTime(DateUtils.getNowDate());
        return mxRebateActivityMapper.updateMxRebateActivity(mxRebateActivity);
    }

    /**
     * 批量删除返利活动
     * 
     * @param ids 需要删除的返利活动主键
     * @return 结果
     */
    @Override
    public int deleteMxRebateActivityByIds(String[] ids)
    {
        return mxRebateActivityMapper.deleteMxRebateActivityByIds(ids);
    }

    /**
     * 删除返利活动信息
     * 
     * @param id 返利活动主键
     * @return 结果
     */
    @Override
    public int deleteMxRebateActivityById(String id)
    {
        return mxRebateActivityMapper.deleteMxRebateActivityById(id);
    }
}
